﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MCWorldLibrary
{
    class Vector3
    {
        public int X { get; set; }
        public int Y { get; set; }
        public int Z { get; set; }

        public Vector3(int x, int y, int z)
        {
            this.X = x;
            this.Y = y;
            this.Z = z;
        }

        public Vector3(Vector3 other)
        {
            this.X = other.X;
            this.Y = other.Y;
            this.Z = other.Z;
        }

        public override string ToString()
        {
            return string.Format("X:{0} Y:{1} Z:{2}", X, Y, Z);
        }

        public static Vector3 operator-(Vector3 a, Vector3 b)
        {
            return new Vector3(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
        }

        public static Vector3 operator +(Vector3 a, Vector3 b)
        {
            return new Vector3(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
        }

        public class EqualityComparer : IEqualityComparer<Vector3>
        {
            public bool Equals(Vector3 x, Vector3 y)
            {
                return x.X == y.X && x.Y == y.Y && x.Z == y.Z;
            }

            public int GetHashCode(Vector3 obj)
            {
                return obj.X.GetHashCode() + obj.Y.GetHashCode() + obj.Z + GetHashCode();
            }
        }
    }

    class Vector2
    {
        public int X { get; set; }
        public int Y { get; set; }

        public Vector2(int x, int y)
        {
            this.X = x;
            this.Y = y;
        }

        public Vector2(Vector2 other)
        {
            this.X = other.X;
            this.Y = other.Y;
        }

        public override string ToString()
        {
            return string.Format("X:{0} Y:{1}", X, Y);
        }

        public class EqualityComparer : IEqualityComparer<Vector2>
        {
            public bool Equals(Vector2 x, Vector2 y)
            {
                return x.X == y.X && x.Y == y.Y;
            }

            public int GetHashCode(Vector2 obj)
            {
                return obj.X.GetHashCode() + obj.Y.GetHashCode();
            }
        }
    }
}
